/**
 * 
 */
package action;

import java.util.Date;
import java.util.List;
import java.util.Map;

import javax.mail.Session;

import org.apache.struts2.ServletActionContext;

import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.ModelDriven;

import pojo.User;
import service.UserService;
import service.impl.UserServiceImpl;

/**
 * @author 陈冠伸
 *2016年6月14日
 */
public class UnBindAction extends ActionSupport {
	
	private UserService userService =new UserServiceImpl();
	private String username;
	private String token;
	private Date bindtime;
	private String remark;
	private String binder;
	Map<String, Object> session = ActionContext.getContext().getSession();

	
	 /*
	  * 解除绑定
	  */
	 
	public String unbind(){
		if(username==null){
			return null;
		}
		boolean b = userService.dele(username);
		if(b){
			return "unbind_success";
		}else{
			return "unbind_false";
		}
		
	}
	
	//校验
	public void validate(){
		String regex = "1[3|4|5|7|8|][0-9]{9}";
		if(!username.matches(regex)){
			this.addFieldError("userError", "请输入有效的手机号码");
		}

	}

	
	
	
	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public String getToken() {
		return token;
	}

	public void setToken(String token) {
		this.token = token;
	}

	public Date getBindtime() {
		return bindtime;
	}

	public void setBindtime(Date bindtime) {
		this.bindtime = bindtime;
	}

	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	public String getBinder() {
		return binder;
	}

	public void setBinder(String binder) {
		this.binder = binder;
	}

	public UserService getUserService() {
		return userService;
	}

	public void setUserService(UserService userService) {
		this.userService = userService;
	}



	/*public Watchuser getWatchuser() {
		return watchuser;
	}



	public void setWatchuser(Watchuser watchuser) {
		this.watchuser = watchuser;
	}*/








}
